<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ page import="edu.njust.LabSystem.entity.*,edu.njust.LabSystem.Service.*" %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
    <%@ include file="/public/include2.jsp" %>

    <title>My JSP 'SelectLab.jsp' starting page</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->

</head>

<body>
<%--     <a href="StudentInfo.jsp?action=StudentInfoController&uid=${uid}">个人中心</a>
    <table>
    <%
  				String uid=(String)session.getAttribute("uid");
  				
  				IStudentService service=new IStudentService();
  				Student student=service.getStudentById(uid);  				
  			 %>
  			 <tr>
      				<td><%=student.getName()%></td>
     		</tr>
     	</table>--%>
<%
    String uid = (String) session.getAttribute("uid");
    IStudentService service = new IStudentService();
    Student student = service.getStudentById(uid);
%>

<div class="nav nav-tabs success" style="background-color: #c9c6fa;height:60px;">
    <div class="" style="float: left;margin-left: 30px">
        <img class="user-photo" style="" src="img/face.jpg"/>
    </div>
    <div class="nav-item" style="float:left;margin-left:5px;">
        <a style=""><%=student.getName() %>
        </a>
    </div>
    <div class="nav-item">
        <a href="StudentHomePage.jsp?uid=${uid}">首页</a>
    </div>
    <div class="nav-item" style="margin-right:5px;">
        <img class="icon" style="width: 20px;height: 20px;" src="img/home.png"/>
    </div>

    <div class="nav-item" style="">
        <a style="" href="StudentInfo.jsp?action=StudentInfoController&uid=${uid}">个人中心</a>
    </div>
    <div class="nav-item" style="margin-right:5px;">
        <img class="icon" style="clear:both;width: 20px;height: 20px;" src="img/person_white.png"/>
    </div>
</div>

<%
    String eid = (String) session.getAttribute("eid");
    eid = request.getParameter("eid");
    session.setAttribute("eid", eid);
    ExperimentService experimentservice = new ExperimentService();
    Experiment experiment = experimentservice.getExperimentById(eid);
    LabAppointmentService lAservice = new LabAppointmentService();
    LabAppointment labAppointment = lAservice.getLabAppointmentByExperiment(eid);

    //eid = request.getParameter("eid");
    //session.setAttribute("eid",eid);
    System.out.println("nananana:" + labAppointment);
    String labId = labAppointment.getLab();
    session.setAttribute("labId", labId);
    LabService lService = new LabService();
    Lab lab = lService.getByLabId(labId);

%>
<div class="table-container" >
    <div class="table-top">
        <span class="table-title">开放性实验选座</span>
    </div>
    <div class="table-main" style=" background-color: #e0e0ff;padding-left: 38%;padding-top:50px;color: #6e5e98;font-size: 18px">

        <form action="StudentAppointmentController" onsubmit="return Form()" method="get" style="">
            <div class="form-group" style="margin-left: 30px;">
                <label>实验名称：</label>
                <span><%=experiment.getName()%></span>
            </div>
            <div class="form-group" style="margin-left: 30px;">
                <label>时间：</label>
                <span><%=labAppointment.getAppoint_date()%></span>
            </div>
            <div class="form-group" style="margin-left: 30px;">
                <label>机房：</label>
                <span><%=lab.getName()%></span>
            </div>
            <div class="form-group" style="margin-left: 30px;clear: both">
                <label style="float: left;padding-top: 4px">座号: </label>
                <span><input style="width: 100px;float: left;margin-left: 10px" class="form-control form-inline" type="text" name="seatId"> </span>
            </div>
            <div class="form-group" style="margin-left: 30px;padding-top: 50px;clear: both">
                <button style="width: 100px;margin-left: 20px;color: white;background-color: #6e5e98;font-weight: bolder" class=" btn btn-info button" type="submit"
                        >提 交</button>
            </div>
        </form>
    </div>
</div>
</body>
</html>
